d->domain = dom_id;
d->processor = cpu;
d->create_time = NOW();
- /* Initialise the state_lock */
- spin_lock_init(&d->state_lock);
+ /* Initialise the sleep_lock */
+ spin_lock_init(&d->sleep_lock);
memcpy(&d->thread, &idle0_task.thread, sizeof(d->thread));
((inf->evt - curr_evt) / BVT_INFO(curr)->mcu_advance) +
ctx_allow;
-
- spin_unlock_irqrestore(&schedule_data[cpu].schedule_lock, flags);
if ( is_idle_task(curr) || (inf->evt <= curr_evt) )
cpu_raise_softirq(cpu, SCHEDULE_SOFTIRQ);
else if ( schedule_data[cpu].s_timer.expires > r_time )
mod_ac_timer(&schedule_data[cpu].s_timer, r_time);
+ spin_unlock_irqrestore(&schedule_data[cpu].schedule_lock, flags);
}
/* Currently-running domain should run at least for ctx_allow. */
min_time = curr->lastschd + ctx_allow;
- spin_unlock_irqrestore(&schedule_data[cpu].schedule_lock, flags);
-
if ( is_idle_task(curr) || (min_time <= now) )
cpu_raise_softirq(cpu, SCHEDULE_SOFTIRQ);
else if ( schedule_data[cpu].s_timer.expires > (min_time + TIME_SLOP) )
mod_ac_timer(&schedule_data[cpu].s_timer, min_time);
+
+ spin_unlock_irqrestore(&schedule_data[cpu].schedule_lock, flags);
}
spin_lock_irqsave(&schedule_data[cpu].schedule_lock, flags);
curr = schedule_data[cpu].curr;
- spin_unlock_irqrestore(&schedule_data[cpu].schedule_lock, flags);
if ( is_idle_task(curr) )
cpu_raise_softirq(cpu, SCHEDULE_SOFTIRQ);
+
+ spin_unlock_irqrestore(&schedule_data[cpu].schedule_lock, flags);
}
{
unsigned long flags;
- /* sleep and wake protected by domain's state_lock */
- spin_lock_irqsave(&d->state_lock, flags);
+ /* sleep and wake protected by domain's sleep_lock */
+ spin_lock_irqsave(&d->sleep_lock, flags);
if ( likely(!domain_runnable(d)) )
SCHED_OP(sleep, d);
- spin_unlock_irqrestore(&d->state_lock, flags);
+ spin_unlock_irqrestore(&d->sleep_lock, flags);
/* Synchronous. */
while ( test_bit(DF_RUNNING, &d->flags) && !domain_runnable(d) )
{
unsigned long flags;
- spin_lock_irqsave(&d->state_lock, flags);
+ spin_lock_irqsave(&d->sleep_lock, flags);
if ( likely(domain_runnable(d)) )
{
clear_bit(DF_MIGRATED, &d->flags);
- spin_unlock_irqrestore(&d->state_lock, flags);
+ spin_unlock_irqrestore(&d->sleep_lock, flags);
}
/* Block the currently-executing domain until a pertinent event occurs. */
/* Scheduling. */
int shutdown_code; /* code value from OS (if DF_SHUTDOWN). */
- spinlock_t state_lock; /* wake/sleep lock */
+ spinlock_t sleep_lock; /* wake/sleep lock */
s_time_t lastschd; /* time this domain was last scheduled */
s_time_t lastdeschd; /* time this domain was last descheduled */
s_time_t cpu_time; /* total CPU time received till now */